function Test-Path2
{
    [CmdletBinding()]
    param (
        [parameter(Position=0, ValueFromPipeline=$True)]
        [string]$Path,
        [parameter()]
        [switch]$Unc,
        [parameter()]
        [switch]$Folder,
        [parameter()]
        [switch]$Throw
    )
        
    begin 
    { 
        $empty = $true 
        
        function ThrowOrReturn([bool]$ret)
        {
            if ($Throw) {
                if (!$ret) {
                    throw "{0} is not a valid {1}{2}" -f 
                        ($Path | ?? "[null]"),
                        ($Unc | ?: "UNC " ""),
                        ($Folder | ?: "folder" "path")
                }
            }
            else { $ret }
        }
    }
        
    process 
    {
        $empty = $false    
        
        try 
        {   
            ThrowOrReturn ( 
                ($Path) -and
                ($Path -ne '') -and
                !($Unc -and !$Path.StartsWith("\\")) -and
                !($Folder -and !(Get-Item $Path -ea SilentlyContinue).PsIsContainer) -and
                ($Path | Test-Path)
            )            
        }
        catch { ThrowOrReturn $false } 
    }    
    
    end 
    {
        if ($empty) { ThrowOrReturn $false }        
    }
}